package utility;

import javax.swing.JOptionPane;

import crm.model.*;

public abstract class  Browser 
{
	
	public int maxLength;
	public static int index=-1;
	
	
	
	public void reactOnBack() throws Exception
	{
		if(index>0)
		{
			index--;
			
			
			System.out.println(index+"Back");
			fillViewFormFromModel();
		}
		else if(index==0)
		{
			JOptionPane.showMessageDialog(null, "End reached");
		}
	}
	
   public void reactOnForward() throws Exception
	{
	  // index=-1;
	   if(index<maxLength-1)
	   {
		   index++;
		  
		   
		  
		   System.out.println(index+"Forward");
		   fillViewFormFromModel();
	   }
	   else if(index==maxLength-1)
	   {
		   JOptionPane.showMessageDialog(null, "End reached");
	   }
			
	}
   
    public abstract void fillViewFormFromModel() throws Exception;
   
    
}
